home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_13_06
/
pjp
/
tiostrea.c
< prev
Wrap
C/C++ Source or Header
|
1995-04-06
|
1KB
|
39 lines
------------- Listing 3: The file tiostrea.c ------------------
// test <iostream>
#include <assert.h>
#include <iostream>
#include <iostream>
int main()
{ // test basic workings of iostream definitions
assert(cin.good() && cin.exceptions() == ios::goodbit
&& cin.flags() == (ios::skipws | ios::dec)
&& cin.precision() == 6 && cin.width() == 0
&& cin.fill() == ' ');
assert(cout.good() && cout.exceptions() == ios::goodbit
&& cout.flags() == (ios::skipws | ios::dec)
&& cout.precision() == 6 && cout.width() == 0
&& cout.fill() == ' ');
assert(cerr.good() && cerr.exceptions() == ios::goodbit
&& cerr.flags()
== (ios::skipws | ios::dec | ios::unitbuf)
&& cerr.precision() == 6 && cerr.width() == 0
&& cerr.fill() == ' ');
assert(clog.good() && clog.exceptions() == ios::goodbit
&& clog.flags() == (ios::skipws | ios::dec)
&& clog.precision() == 6 && clog.width() == 0
&& clog.fill() == ' ');
cout << "Can write on streams:" << endl;
cout << "\tcout" << endl;
cerr << "\tcerr" << endl;
clog << "\tclog" << endl;
assert(cout.good());
assert(cerr.good());
assert(clog.good());
cout << "SUCCESS testing <iostream>" << endl;
return (0);
}